<template>
	<view class="layout">
		<view  v-for="item in arr" class="row" :key="item.id">
			<view class="title">{{item.title}}</view>
			<view class="content">{{item.body}}</view>
		</view>
	</view>
</template>

<script setup>
	let arr = ref([])
	// uni.request({
	// 	url: 'https://jsonplaceholder.typicode.com/posts',
	// 	success: (res) => {
	// 		arr.value = res.data
	// 	}
	// });
	// uni.request({
	// 	url: 'https://jsonplaceholder.typicode.com/posts'
	// }).then(res=>{
	// 	arr.value = res.data
	// });
	
	async function request(){
		let res = await uni.request({
			url: 'https://jsonplaceholder.typicode.com/posts'
		})
		arr.value = res.data
	}
	request()
</script>

<style lang='scss' scoped>
.layout{
	padding: 30rpx;
	.row{
		border: 1px solid #cfcfcf;
		padding: 20rpx 0;
		.title{
			font-size: 36rpx;
			margin-bottom: 10rpx;
		}
		.content{
			font-size: 28rpx;
			color: #666;
		}
	}
}
</style>